package com.li.test.base.jdkproxy;


import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class MyInvocationHandler implements InvocationHandler {

    private Object target;
    MyInvocationHandler(Object target){
        this.target =target;
    }
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        //do something
        System.out.println("功能增强之前");

        Object res = method.invoke(target,args);
        System.out.println("功能增强");
        System.out.println("功能增强之后");

        ;
        return res;
    }
}
